/**
 * 2017年7月20日
 */
package leetcode;

/**
 * @author Alex
 *
 */
public class RemoveDuplicates {
	 public int removeDuplicates(int[] nums) {
	        if (nums.length == 0) return 0;

	        int index = 1;
	        for (int i = 1; i < nums.length; i++) {
	            if (nums[i] != nums[index-1]){
	                nums[index] = nums[i];
	                index ++;
	            }
	            	
	        }
	        return index;
	 }
	 public static void main(String[] args) {
		RemoveDuplicates rd = new RemoveDuplicates();
		System.out.println(rd.removeDuplicates(new int[]{1,2,3,3,5,5,6}));
	}
}
